<html>
<head>
<script src="../trunk/jquery.js"> </script>
<script>

if( window.console==undefined){
    window.console = {
        log:function(str){ $("body").append(str)}
    };
}
var create=function(i,m){
    while(--i){
        $("<span>", i%m?{ "customattr":"value"} : { "class":"customclass"}).text(i).appendTo("body");
    }
}

var testClass=function(){
    var start= new Date().getTime();
    var counter =0;
    do{
        $(".customclass");
        ++counter;
    }while( new Date().getTime()-start < 1000);
    return counter;
}

var testAttr= function(){
    var start= new Date().getTime();
    var counter =0;
    do{
        $('[customAttr]');
        ++counter;
    }while( new Date().getTime()-start < 1000);
    return counter;
}

var testAttr2= function(){
    var start= new Date().getTime();
    var counter =0;
    do{
        $('[customAttr="value"]');
        ++counter;
    }while( new Date().getTime()-start < 1000);
    return counter;
}

var run= function(runs){
    var c=[0,0,0];
    var k=runs;
    while( k--){
        c[0] += testClass();
        c[1] += testAttr();
        c[2] += testAttr2();
    };
    
    console.log("testClass avg runs/sec:",c[0]/runs);
    console.log("testAttr avg runs/sec:",c[1]/runs);
    console.log("testAttr2 avg runs/sec:",c[2]/runs);
}

</script>
</head>
<body>

</body>
</html>